<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
	<head>
		<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
		<title>Testing ion calculator class</title>
	</head>
	<body>
		<script type="text/javascript" src="lib/ext3/ext-base.js"></script>
		<script type="text/javascript" src="lib/ext3/ext-all.js"></script>
		<script type="text/javascript" src="../jsprot/constants.js"></script>
		<script type="text/javascript" src="../jsprot/XProtBase.js"></script>
		<script type="text/javascript" src="../jsprot/Peptide.js"></script>
		<script type="text/javascript" src="../jsprot/ModifiedPeptide.js"></script>
		<script type="text/javascript" src="../jsprot/peptide/IonCalculator.js"></script>
		
		<script type="text/javascript">
			var pep = new mpimp.jsprot.ModifiedPeptide();
			pep.Sequence = 'KDEPAEESDGDLGFGLFD';
			pep.NTerminus = 'H';
			pep.CTerminus = 'OH';
			pep.addModification({
				accession: 21,
				position: 7
			});
			
			var strIon = 'b';
			var ic = new mpimp.jsprot.peptide.IonCalculator({
				peptide: pep,
				maxcharge: 3,
				weighttype: 'monoisotopic',
				neutralloss: ['H2O', 'NH3'],
				customtemplate: new Ext.XTemplate('{ion}{index}{["++++++++++".substr(0, values.charge)]} {flag}')
			});
			
			document.writeln('<h3>Testing</h3>');
			document.writeln('Peptide: '+pep.Sequence+'<br />');
			
			document.writeln('<h3>Result for '+strIon+'-Ions</h3>');
			document.writeln('<table style="border: null">');
			var arrResult = ic.calculateIon(strIon);
			for (var i=0; i<arrResult.length; i++) {
				document.writeln('<tr><td>'+String(arrResult[i].mass)+'</td><td>'+arrResult[i].ion+String(arrResult[i].index)+
					'</td><td>+'+String(arrResult[i].charge)+'</td><td>'+arrResult[i].flag+'</td><td>'+arrResult[i].custom+'</td></tr>');
			}
			document.writeln('</table>');
			
			
			document.writeln('<h3>Testing</h3>');
			document.writeln('Peptide: '+pep.Sequence+'<br />');
			var strIon = 'y';
			document.writeln('<h3>Result for '+strIon+'-Ions</h3>');
			document.writeln('<table style="border: null">');
			var arrResult = ic.calculateIon(strIon);
			for (var i=0; i<arrResult.length; i++) {
				document.writeln('<tr><td>'+String(arrResult[i].mass)+'</td><td>'+arrResult[i].ion+String(arrResult[i].index)+
					'</td><td>+'+String(arrResult[i].charge)+'</td><td>'+arrResult[i].flag+'</td><td>'+arrResult[i].custom+'</td></tr>');
			}
			document.writeln('</table>');
		</script>
	</body>
</html>